#!/bin/bash

apt-get update
apt-get install nano wget openssl -y
#wget https://gitee.com/weizy1983/CNSolutions/raw/master/ubuntu/ca-certificate/ca-certificates_20210119~20.04.2_all.deb
#dpkg -i ca-certificates_20210119~20.04.2_all.deb 
wget https://gitee.com/weizy1983/CNSolutions/raw/master/ubuntu/ca-certificate/ca-certificates_20211016_all.deb
dpkg -i ca-certificates_20211016_all.deb

if [ -n "$1" ]; then
    wget -O sources.list https://gitee.com/weizy1983/CNSolutions/raw/master/ubuntu/tunasource/$1.sources.list
else
    wget -O sources.list https://gitee.com/weizy1983/CNSolutions/raw/master/ubuntu/tunasource/ubuntu20.04.sources.list
fi
[ $? -eq 0 ] || (echo "command fault, exit";exit) && cp /etc/apt/sources.list /etc/apt/sources.list.bak
[ $? -eq 0 ] || (echo "command fault, exit";exit) && mv ./sources.list /etc/apt/sources.list
apt-get update
echo "success full finished!"
